<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .v-enter-active{
            animation: move 3s linear;
        }
        .v-leave-active{
            animation: move 3s linear alternate-reverse;
        }
        @keyframes move{
            0% {
                margin-left: 200px;
            }
            100% { 
                margin-left: 0;
            } 
        }
    </style>
</head>
<body>
    <div id="root">
        <button @click="isShow = !isShow">改变状态</button>
        <transition>
            <h1 v-show="isShow">{{str}}</h1>
        </transition>
    </div>
    <script src="../js/vue.js"></script>
    <script>
        new Vue({
            el: '#root',
            data: {
                isShow: true,
                str: '你好'
            }
        })
    </script>
</body>
</html>